v2csreprss,
v2csrlgrep,
v2mecenefm,
v2meharjrn,
v2meslfcen,
v2psbars,
v2psparban,
v2clkill,
v2cltort,
v2cldiscm,
v2cldiscw,
v2psoppaut,
v2cseeorgs,
v2clslavem,
v2clslavef,
v2clprptym,
v2clprptyw,
v2clfmove,
v2cldmovem,
v2cldmovew,
v2clrelig,
v2csrlgrep,
citizen,
activist,
former_government_official,
journalist,
opposition,
attempts,
threats,
executed,
diplo_rep_lag,
diplo_intens_lag,
visit_noNA_lag,
theta_mean_lag) %>%
as.data.frame()
save(data_final, file = "data/data_final.Rda")
# load final data set
load("data/data_final.Rda")
##### Table 1: Summary table #####
data_final_fe %>%
mutate(tenure_lag_log = log(tenure_lag),
pop_lag_log = log(pop_lag),
gdp_pc_lag_log = log(gdp_pc_lag)) %>%
select(any_event, all_events,
v2x_civlib_lag_inv,
e_polity2_lag,
elections,
tenure_lag_log,
v2x_ex_party_lag,
v2x_ex_military_lag,
pop_lag_log,
gdp_pc_lag_log,
Capacity_lag,
diplo_rep_lag) %>%
st(out = "latex", file = "tables/table1.tex")
# Model 1, domestic repression and fixed effects only
m1_fe_civ <- glm(any_event ~  I(v2x_civlib_lag_inv*10) +
iso3c + year, data = data_final_fe,
binomial(link = "logit"),
intercept = F,
method = "brglmFit", type = "MPL_Jeffreys")
# Model 2, adding control variables
m2_fe_civ <- glm(any_event ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) +
iso3c + year, data = data_final_fe,
binomial(link = "logit"),
intercept = F,
method = "brglmFit", type = "AS_mixed")
# Model 3,interaction with state capacity
m3_fe_civ <- glm(any_event ~  I(v2x_civlib_lag_inv*10)*I(Capacity_lag*10) +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) +
iso3c + year, data = data_final_fe,
binomial(link = "logit"),
intercept = F,
method = "brglmFit", type = "AS_mixed")
ggplot(data_final_fe, aes(x = civlib_inv_diff2, y = any_event)) +
#  geom_rug( sides="b") +
geom_point(aes(color = factor(any_event)), alpha = .35) +
xlab("Change in domestic repression (t-1)") +
ylab("Probability of transnational repression (t)") +
scale_color_grey() +
geom_smooth(method = "glm", method.args = list(family = "binomial"),
formula= y ~ x, se = T,lwd=0.5, colour="black") +
theme_bw() +
theme(legend.position = "none")
# Model 1, domestic repression and fixed effects only
m1_fe_civ <- glm(any_event ~  I(v2x_civlib_lag_inv*10) +
iso3c + year, data = data_final_fe,
binomial(link = "logit"),
intercept = F,
method = "brglmFit", type = "MPL_Jeffreys")
# Model 2, adding control variables
m2_fe_civ <- glm(any_event ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) +
iso3c + year, data = data_final_fe,
binomial(link = "logit"),
intercept = F,
method = "brglmFit", type = "AS_mixed")
# Model 3,interaction with state capacity
m3_fe_civ <- glm(any_event ~  I(v2x_civlib_lag_inv*10)*I(Capacity_lag*10) +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) +
iso3c + year, data = data_final_fe,
binomial(link = "logit"),
intercept = F,
method = "brglmFit", type = "AS_mixed")
# Model 4, adding interaction with diplomatic representation
m4_fe_civ <- glm(any_event ~  I(v2x_civlib_lag_inv*10)*I(diplo_rep_lag/10) +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) +
iso3c + year, data = data_final_fe,
binomial(link = "logit"),
intercept = F,
method = "brglmFit", type = "AS_mixed")
texreg(file = "tables/table2.tex",
list(m1_fe_civ, m2_fe_civ, m3_fe_civ, m4_fe_civ),
stars = c(0.001, 0.01, 0.05,0.1),
booktabs = TRUE,
label = "main_reg",
omit.coef = "(year|iso3c|Intercept)",
float.pos = "h",
caption = "Main regression results. Relationship between civil liberties (V-Dem) and transnational repression events",
custom.coef.names = c("Domestic repression",
"Polity score", "Elections",
"Leader tenure (log)",
"Military dimension index",
"Party dimension index",
"Population (log)",
"GDP per capita (log)",
"State capacity index",
"Repression x State capacity",
"Diplomatic representation abroad",
"Repression x Diplomatic representation"))
View(ucdp)
###### RUN THIS SCRIPT FIRST ##### #-------------------------------------------#
# This script loads all packages that are required to reproduce all figures and tables.
# Please make sure that all packages are in the correct version (see below).
# It is important to run these scripts in the right order.
# Libraries
# load packages
library(tidyverse)
library(countrycode)
library(tidylog)
library(janitor)
library(wbstats)
library(haven)
library(rworldmap)
library(vtable)
library(lme4)
library(texreg)
library(marginaleffects)
library(brglm2)
library(fixest)
library(vdemdata)
# R script 1: 01_dataprep.R
# This script prepares the transnational event data for merging and merges it with
# additional data sources (see folder "data").
source("Rscripts/01_dataprep.R")
###### RUN THIS SCRIPT FIRST ##### #-------------------------------------------#
# This script loads all packages that are required to reproduce all figures and tables.
# Please make sure that all packages are in the correct version (see below).
# It is important to run these scripts in the right order.
# Libraries
# load packages
library(tidyverse)
library(countrycode)
library(tidylog)
library(janitor)
library(wbstats)
library(haven)
library(rworldmap)
library(vtable)
library(lme4)
library(texreg)
library(marginaleffects)
library(brglm2)
library(fixest)
library(vdemdata)
# R script 1: 01_dataprep.R
# This script prepares the transnational event data for merging and merges it with
# additional data sources (see folder "data").
source("Rscripts/01_dataprep.R")
# R script 2: 02_descriptives.R
# This script generates the descriptive figures in the paper.
source("Rscripts/02_descriptives.R")
# R script 3: 03_models.R
# This script runs all regression models in the main text and the Appendix.
source("Rscripts/03_models.R")
sessionInfo()
install.packages("grateful")
library(grateful)
cite_packages(out.dir = ".")
# Libraries
# load packages
library(tidyverse)
library(countrycode)
library(tidylog)
library(janitor)
library(wbstats)
library(haven)
library(rworldmap)
library(vtable)
library(lme4)
library(texreg)
library(marginaleffects)
library(brglm2)
library(fixest)
library(vdemdata)
# Libraries
# load packages
library(tidyverse)
library(countrycode)
library(tidylog)
library(janitor)
library(wbstats)
library(haven)
library(rworldmap)
library(vtable)
library(lme4)
library(texreg)
library(marginaleffects)
library(brglm2)
library(fixest)
library(vdemdata)
# load final data set
load("data/data_final.Rda")
# R script 1: 01_dataprep.R
# This script prepares the transnational event data for merging and merges it with
# additional data sources (see folder "data").
source("Rscripts/01_dataprep.R")
# load final data set
load("data/data_final.Rda")
##### Table 1: Summary table #####
data_final_fe %>%
mutate(tenure_lag_log = log(tenure_lag),
pop_lag_log = log(pop_lag),
gdp_pc_lag_log = log(gdp_pc_lag)) %>%
select(any_event, all_events,
v2x_civlib_lag_inv,
e_polity2_lag,
elections,
tenure_lag_log,
v2x_ex_party_lag,
v2x_ex_military_lag,
pop_lag_log,
gdp_pc_lag_log,
Capacity_lag,
diplo_rep_lag) %>%
st(out = "latex", file = "tables/table1.tex")
# Model 1, domestic repression and fixed effects only
m1_fe_civ <- glm(any_event ~  I(v2x_civlib_lag_inv*10) +
iso3c + year, data = data_final_fe,
binomial(link = "logit"),
intercept = F,
method = "brglmFit", type = "MPL_Jeffreys")
# Model 2, adding control variables
m2_fe_civ <- glm(any_event ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) +
iso3c + year, data = data_final_fe,
binomial(link = "logit"),
intercept = F,
method = "brglmFit", type = "AS_mixed")
# Model 3,interaction with state capacity
m3_fe_civ <- glm(any_event ~  I(v2x_civlib_lag_inv*10)*I(Capacity_lag*10) +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) +
iso3c + year, data = data_final_fe,
binomial(link = "logit"),
intercept = F,
method = "brglmFit", type = "AS_mixed")
# Model 4, adding interaction with diplomatic representation
m4_fe_civ <- glm(any_event ~  I(v2x_civlib_lag_inv*10)*I(diplo_rep_lag/10) +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) +
iso3c + year, data = data_final_fe,
binomial(link = "logit"),
intercept = F,
method = "brglmFit", type = "AS_mixed")
texreg(file = "tables/table2.tex",
list(m1_fe_civ, m2_fe_civ, m3_fe_civ, m4_fe_civ),
stars = c(0.001, 0.01, 0.05,0.1),
booktabs = TRUE,
label = "main_reg",
omit.coef = "(year|iso3c|Intercept)",
float.pos = "h",
caption = "Main regression results. Relationship between civil liberties (V-Dem) and transnational repression events",
custom.coef.names = c("Domestic repression",
"Polity score", "Elections",
"Leader tenure (log)",
"Military dimension index",
"Party dimension index",
"Population (log)",
"GDP per capita (log)",
"State capacity index",
"Repression x State capacity",
"Diplomatic representation abroad",
"Repression x Diplomatic representation"))
# Model 2 feglm
m2_fixest_glm <- feglm(any_event ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) |
iso3c + year, data = data_final_fe,
binomial(link = "logit"),
panel.id = c("iso3c", "year"),
vcov = "DK")
m2_fixest_pois <- fepois(all_events ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) |
iso3c + year, data = data_final_fe,
panel.id = c("iso3c", "year"),
vcov = "DK")
m2_fixest_negbin <- fenegbin(all_events ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) |
iso3c + year, data = data_final_fe,
panel.id = c("iso3c", "year"),
vcov = "DK")
m2_fixest_ols <- feols(all_events ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) |
iso3c + year, data = data_final_fe,
panel.id = c("iso3c", "year"),
vcov = "DK")
texreg(file = "tables/table_A2.tex",
list(m2_fixest_glm,m2_fixest_pois, m2_fixest_negbin, m2_fixest_ols),
stars = c(0.001, 0.01, 0.05,0.1),
booktabs = TRUE,
label = "main_reg",
omit.coef = "(year|iso3c)",
float.pos = "h",
caption = "Robustness tests. Main Model (Model 2) with different model specifications.",
custom.coef.names = c("Domestic repression",
"Polity score", "Elections",
"Leader tenure (log)",
"Military dimension index",
"Party dimension index",
"Population (log)",
"GDP per capita (log)",
"State capacity index",
"Theta"))
###### RUN THIS SCRIPT FIRST ##### #-------------------------------------------#
# This script loads all packages that are required to reproduce all figures and tables.
# Please make sure that all packages are in the correct version (see below).
# It is important to run these scripts in the right order.
# Libraries
# load packages
library(tidyverse)
library(countrycode)
library(tidylog)
library(janitor)
library(wbstats)
library(haven)
library(rworldmap)
library(vtable)
library(lme4)
library(texreg)
library(marginaleffects)
library(brglm2)
library(fixest)
library(vdemdata)
# R script 1: 01_dataprep.R
# This script prepares the transnational event data for merging and merges it with
# additional data sources (see folder "data").
source("Rscripts/01_dataprep.R")
# R script 2: 02_descriptives.R
# This script generates the descriptive figures in the paper.
source("Rscripts/02_descriptives.R")
# R script 3: 03_models.R
# This script runs all regression models in the main text and the Appendix.
source("Rscripts/03_models.R")
# Output from Session Info
# R version 4.1.0 (2021-05-18)
# Platform: x86_64-apple-darwin17.0 (64-bit)
# Running under: macOS Big Sur 11.7.6
#
# Matrix products: default
# LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
#
# locale:
#   [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#
# attached base packages:
#   [1] stats     graphics  grDevices utils     datasets  methods   base
#
# other attached packages:
#   [1] vdemdata_3.0           fixest_0.10.5          brglm2_0.8.0           marginaleffects_0.10.0 texreg_1.37.5
# [6] lme4_1.1-27            Matrix_1.3-3           vtable_1.3.4           kableExtra_1.3.4       rworldmap_1.3-6
# [11] sp_1.4-5               haven_2.5.0            wbstats_1.0.5.9000     janitor_2.1.0          tidylog_1.0.2
# [16] countrycode_1.4.0      forcats_0.5.1          stringr_1.5.0          dplyr_1.1.0            purrr_1.0.1
# [21] readr_2.1.2            tidyr_1.3.0            tibble_3.2.0           ggplot2_3.4.1          tidyverse_1.3.1
#
# loaded via a namespace (and not attached):
#   [1] minqa_1.2.4         colorspace_2.1-0    ggsignif_0.6.1      ellipsis_0.3.2      rio_0.5.26          sjlabelled_1.1.8
# [7] snakecase_0.11.0    fs_1.5.2            rstudioapi_0.13     ggpubr_0.4.0        farver_2.1.1        bit64_4.0.5
# [13] fansi_1.0.4         lubridate_1.9.2     xml2_1.3.3          splines_4.1.0       knitr_1.43          spam_2.7-0
# [19] Formula_1.2-5       jsonlite_1.8.0      nloptr_1.2.2.2      broom_0.8.0         dbplyr_2.1.1        compiler_4.1.0
# [25] httr_1.4.3          backports_1.4.1     assertthat_0.2.1    fastmap_1.1.0       cli_3.6.0           htmltools_0.5.4
# [31] tools_4.1.0         dotCall64_1.0-1     enrichwith_0.3.1    gtable_0.3.1        glue_1.6.2          dreamerr_1.2.3
# [37] maps_3.4.0          Rcpp_1.0.10         carData_3.0-4       cellranger_1.1.0    vctrs_0.5.2         svglite_2.0.0
# [43] nlme_3.1-152        insight_0.19.0      xfun_0.39           openxlsx_4.2.3      rvest_1.0.2         timechange_0.2.0
# [49] lifecycle_1.0.3     rstatix_0.7.0       MASS_7.3-54         zoo_1.8-11          scales_1.2.1        vroom_1.5.7
# [55] clisymbols_1.2.0    hms_1.1.1           parallel_4.1.0      sandwich_3.0-2      fields_12.5         curl_4.3.2
# [61] gridExtra_2.3       stringi_1.7.12      maptools_1.1-1      checkmate_2.0.0     boot_1.3-28         zip_2.2.0
# [67] rlang_1.0.6         pkgconfig_2.0.3     systemfonts_1.0.2   evaluate_0.15       lattice_0.20-44     labeling_0.4.2
# [73] cowplot_1.1.1       bit_4.0.4           tidyselect_1.2.0    magrittr_2.0.3      R6_2.5.1            generics_0.1.3
# [79] DBI_1.1.2           mgcv_1.8-35         pillar_1.8.1        foreign_0.8-81      withr_2.5.0         abind_1.4-5
# [85] nnet_7.3-16         car_3.0-10          modelr_0.1.8        crayon_1.5.1        utf8_1.2.3          tzdb_0.3.0
# [91] rmarkdown_2.13      viridis_0.6.1       grid_4.1.0          readxl_1.4.0        data.table_1.14.2   reprex_2.0.1
# [97] digest_0.6.31       webshot_0.5.2       numDeriv_2016.8-1.1 munsell_0.5.0       viridisLite_0.4.1
library(tidyverse)
library(countrycode)
library(tidylog)
library(janitor)
library(wbstats)
library(haven)
library(rworldmap)
library(vtable)
library(lme4)
library(texreg)
library(marginaleffects)
library(brglm2)
library(fixest)
library(vdemdata)
# load final data set
load("data/data_final.Rda")
# Model 2 feglm
m2_fixest_glm <- feglm(any_event ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) |
iso3c + year, data = data_final_fe,
binomial(link = "logit"),
panel.id = c("iso3c", "year"),
vcov = "DK")
m2_fixest_pois <- fepois(all_events ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) |
iso3c + year, data = data_final_fe,
panel.id = c("iso3c", "year"),
vcov = "DK")
m2_fixest_negbin <- fenegbin(all_events ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) |
iso3c + year, data = data_final_fe,
panel.id = c("iso3c", "year"),
vcov = "DK")
m2_fixest_ols <- feols(all_events ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) |
iso3c + year, data = data_final_fe,
panel.id = c("iso3c", "year"),
vcov = "DK")
screenreg( list(m2_fixest_glm,m2_fixest_pois, m2_fixest_negbin, m2_fixest_ols))
# Model 2 feglm
m2_fixest_glm <- feglm(any_event ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) |
iso3c + year, data = data_final_fe,
binomial(link = "logit"),
panel.id = c("iso3c", "year"),
vcov = "DK")
m2_fixest_pois <- fepois(all_events ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) |
iso3c + year, data = data_final_fe,
panel.id = c("iso3c", "year"),
vcov = "NW")
m2_fixest_negbin <- fenegbin(all_events ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) |
iso3c + year, data = data_final_fe,
panel.id = c("iso3c", "year"),
vcov = "NW")
m2_fixest_ols <- feols(all_events ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) |
iso3c + year, data = data_final_fe,
panel.id = c("iso3c", "year"),
vcov = "NW")
# Model 2 feglm
m2_fixest_glm <- feglm(any_event ~ I(v2x_civlib_lag_inv*10)  +
e_polity2_lag + elections + I(log(tenure_lag)) +
v2x_ex_military_lag  +
v2x_ex_party_lag  +  log(pop_lag) + log(gdp_pc_lag) + I(Capacity_lag*10) |
iso3c + year, data = data_final_fe,
binomial(link = "logit"),
panel.id = c("iso3c", "year"),
vcov = "NW")
screenreg( list(m2_fixest_glm,m2_fixest_pois, m2_fixest_negbin, m2_fixest_ols))
